package com.mjk.common.ai.work.admin;

import com.mjk.common.ai.dto.AiModelDto;
import com.mjk.common.ai.dto.AiModelSearchReq;
import com.mjk.common.ai.service.AiModelService;
import com.mjk.common.base.error.BeeError;
import com.mjk.common.base.response.BeeResponse;
import com.mjk.common.base.work.BaseWork;
import com.mjk.common.base.work.annotation.BeeWork;
import jakarta.annotation.Resource;

@BeeWork(work = "model")
public class AdminModelWork extends BaseWork {

    @Resource
    private AiModelService aiModelService;

    public BeeResponse getModelList(AiModelSearchReq aiModelSearchReq) {
        return BeeError.BEE_SUC.tranceError(aiModelService.search(aiModelSearchReq, aiModelSearchReq.getPageStart(), aiModelSearchReq.getPageSize()));
    }

    public BeeResponse addModel(AiModelDto aiModelDto) {
        needParams(aiModelDto, AiModelDto::getPlatform, AiModelDto::getType);
        aiModelService.addOne(aiModelDto);
        return BeeError.BEE_SUC.tranceError();
    }

    public BeeResponse editModel(AiModelDto aiModelDto) {
        needParams(aiModelDto, AiModelDto::getPlatform, AiModelDto::getType);
        aiModelService.edit(aiModelDto);
        return BeeError.BEE_SUC.tranceError();
    }

    public BeeResponse delModel(AiModelDto aiModelDto) {
        aiModelService.softDelete(aiModelDto.getId());
        return BeeError.BEE_SUC.tranceError();
    }
}
